package edu.ucla.whi.wanda;

import org.restlet.data.MediaType;
import org.restlet.ext.freemarker.TemplateRepresentation;
import org.restlet.representation.Representation;
import org.restlet.resource.ClientResource;
import org.restlet.resource.Get;

public class RootResource extends BaseResource {
	public static final String path = "/";
	public static final String description = "Show an introductory page";
	
	public RootResource() {
		super();
		
		initDescribe(path, description, null, MediaType.TEXT_HTML);
	}
	
	@Override
	protected void doInit() {
		setAutoDescribing(false);
	}
	
	public TemplateRepresentation parseTemplate(String file) {
		Representation template = new ClientResource("war:///" + file).get();
		return new TemplateRepresentation(template, MediaType.TEXT_HTML);	
	}

	@Get("html")
	public Representation Get() {
		return parseTemplate("index.html");
	}
}